var  INDEX = function(){
	var o = { };
	var pageno =1;
	var status = false;
	var type_id = getParam("type_id");
	o.run = function()
	{
		this.getType();
		this.getArticle();
		this.loadLunbo();
		this.loadfooter();	
	};
            o.getType = function(){
           		 $.get('/Api/Type/tlist',null,function(res){
	                         var html = template('menu-list-tpl', res);
	                         var html1 = template('more-menu-tpl',res);
	                         $(".pet_circle_nav_list").find('li').eq(1).after(html);
	                         $(".more-menu-box").append(html1);

	                         
            		});
	}

             o.getArticle = function(){
             	status = false;
	             $.get('/Api/Article/alist',{'pageno':pageno,'type_id':type_id},function(ret){
	            	if (ret.status==true) {
	            	            var html = template('article-list-tpl', ret);
	                         $("#article-list-box").append(html);
	                        　　　
	                         $('.am-list-thumb img').load(function(){
	                          	auto_resize();
	                          });
	                         $('.am-gallery').pureview();   
	                         $(document).bind('scroll',function(){o.scrollLoad();});  
	                         pageno++;
	                         status = true;            	                   
	            	}else{
	            		$(document).unbind('scroll');
	            	}	
	                     
	            });
             }

             o.scrollLoad = function()
	{
		//滚动条卷去的高度
		var scrollTop = $(window).scrollTop();
		var winHei = $(window).height();
		var offsetTop = $('#load-tip').offset().top;
		if ( scrollTop + winHei >= offsetTop && status==true )
		{		
			$(document).unbind('scroll');
			o.getArticle();
		}
	}

	o.loadLunbo = function(){
		 $.get('/Api/Lunbo/loadlunbo',null,function(res){
	                         var html = template('lunbolist', res);
	                         $("#lunbo-box").append(html);
	                         $('.am-slider').flexslider(
				{
					 startAt: 0,                     // Integer: 开始播放的 slide，从 0 开始计数
					 slideshow: true,                // Boolean: 是否自动播放
					 slideshowSpeed: 5000,           // Integer: ms 滚动间隔时间
					 animationSpeed: 600,            // Integer: ms 动画滚动速度
				}
			);
            		});
	}
             
             o.loadfooter = function(){
             	$.get('Api/Copy/loadcopy',null,function(res){
             		// alert(res.);
             		var html = template('footer',res);
             		$("#footer-box").append(html);
             	});
             	//var html = template('footer');
             	
             }
     	return o;     
}();